Component({
  externalClasses: ['title-class', 'icon-class', 'number-class'],
  options: {
    multipleSlots: true,
  },
  properties: {
    orderTagInfos: {
      type: Array,
      value: [],
    },
    title: {
      type: String,
      value: '全部订单',
    },
    desc: {
      type: String,
      value: '',
    },
    isTop: {
      type: Boolean,
      value: true,
    },
    classPrefix: {
      type: String,
      value: 'wr',
    },
  },
  methods: {
    async onClickItem(e) {
      const token = await wx.getStorageSync('user_token');
      console.log(token, 'token')
      if (token) {
        console.log(e.currentTarget.dataset.item, 'e.currentTarget.dataset.item11')
        this.triggerEvent('onClickItem', e.currentTarget.dataset.item);
      } else {
        wx.showToast({
          title: '请先登录',
          icon: 'error',
          duration: 1000
        })
        setTimeout(() => {
          wx.reLaunch({
            url: '/pages/usercenter/index',
          })
        }, 1000)
      }
    },

    async onClickTop() {
      const token = await wx.getStorageSync('user_token');
      if (token) {
        this.triggerEvent('onClickTop', {});
      } else {
        wx.showToast({
          title: '请先登录',
          icon: 'error',
          duration: 1000
        })
        setTimeout(() => {
          wx.reLaunch({
            url: '/pages/usercenter/index',
          })
        }, 1000)
      }
    },
  },
});